package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class JdbcDemo3 {
    public static void main(String[] args) throws Exception {
        try( Connection connection=DBUtil.getConnection();) {

            //创建语句执行对象
            Statement statement = connection.createStatement();
            String sql = "UPDATE userinfo SET password='888887' WHERE username='123'";
            int nums = statement.executeUpdate(sql);
            if (nums > 0) {
                System.out.println("修改成功");
            } else {
                System.out.println("修改失败");
            }
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }
    }
}
